//
//  HLEditInfoRequest.m
//  YueYue
//
//  Created by hulu001 on 2023/5/19.
//

#import "HLEditInfoRequest.h"

@implementation HLEditInfoRequest
{
    NSDictionary *_editInfo;
}

- (id)initWithEditInfo:(NSDictionary *)editInfo
{
    self = [super init];
    
    if (self) {
        _editInfo = editInfo;
    }
    
    return self;
}

- (NSString *)requestUrl
{
    return @"/user/home_page/update";
}

- (YTKRequestMethod)requestMethod
{
    return YTKRequestMethodPOST;
}

- (id)requestArgument
{
    return _editInfo;
}

- (HLUserInfoModel *)user
{
    HLUserInfoModel *user;
    NSDictionary *data = [self.result valueForKey:@"data"];
    if (![data isKindOfClass:[NSDictionary class]]){
        return user;
    }
    
    user = [HLUserInfoModel mj_objectWithKeyValues:data[@"femaleUserEntity"]];
    
    if ([user.userId isEqualToString:[HLRunTime shareInstance].mine.userId]){
        [HLRunTime shareInstance].mine = user;
    }
    
    return user;
}
@end
